<template>
    <div>
      <Card class="clearfix" style="padding-bottom: 16px">
        <p slot="title">
          企业列表
        </p>
        <Form label-position="left" :label-width="72">
          <Row :gutter="15">
            <i-col span="6">
              <FormItem label="手机号码：">
                <Input v-model="mobile" placeholder="请输入手机号码" clearable/>
              </FormItem>
            </i-col>
            <i-col span="6">
              <FormItem label="审核状态：">
                <Select v-model="statusValue" clearable>
                  <Option v-for="index in statusList" :value="index.value" :key="index.value">{{ index.label }}</Option>
              </Select>
              </FormItem>
            </i-col>
            <i-col span="6">
              <Button type="success" @click="searchData" icon="ios-search" >搜索</Button>
            </i-col>
          </Row>
        </Form>
        <br>
        <div>
            <list-table refs="table1" v-model="tableData" :access="access" :table-data="tableData"></list-table>
        </div>
        <Page ref="pages" :total="itemTotal" show-total style="float: right; margin-top: 20px" @on-change="getList"></Page>
      </Card>
    </div>
</template>

<script>
import listTable from './components/listTable.vue'
import ajax from '../../../libs/axios.js'
export default {
    name: 'partyindex',
    components: {
        listTable
    },
    data () {
        return {
           loginName: '',           // 用户名称
           mobile:'',               // 手机号
           itemTotal: 0,            // 目前在没有找到合适的获取数据总个数之前，先使用默认值数据
           statusValue: '',         // 审核状态
           tableData: [],           // 表格数据集
           statusList: [
                    {
                        value: 1,
                        label: '待审核'
                    },
                    {
                        value: 2,
                        label: '审核成功'
                    },
                    {
                        value: 3,
                        label: '审核失败'
                    }
                ],
           access: {
                add: true, //控制编辑按钮显示
                func: true,
                remove: true,
                edit: true
            },
        }
    },
    mounted () {
      this.init()
    },
    activated() {
      this.init()
    },
    methods: {
        // 数据初始化
        init () {
           this.$store.commit('setActiveName', 'bankinginfoindex');
           this.getList(1)
        },
        // 搜索
        searchData () {
            if (this.statusValue == undefined){
              this.statusValue="";
            }
            this.getList(1)
        },
        // 获取表格数据
        getList (page) {
            let _that = this;
            let url = 'adminlogin/selectCjParty'
            let data = {
                statusValue:this.statusValue,
                mobile: this.mobile,
                loginName: this.loginName,
                pageSize: 10,
                pageNum: page
            }
            ajax.formRes(url, data).then(res => {
                _that.tableData = res.data;
                _that.itemTotal = res.count;
            }).catch(err => {
                console.log('有错误信息')
            })
        }
    },
}
</script>

<style lang="less">
  @import "../../../styles/common.less";
  @import "../../../styles/table.less";
</style>

